package com.AICoupon.tools;

import com.AICoupon.dto.Reservation;
import com.AICoupon.service.ReservationService;
import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class ReservationTool {
    @Autowired
    private ReservationService reservationService;

    @Tool("预约志愿填报服务")
    public void addReservation(
            @P("考生姓名") String name,
            @P("考生手机号码") String phone,
            @P("考生性别") String gender,
            @P("考生省份") String province,
            @P("预估分数") Integer estimatedScore,
            @P("预约沟通时间")String communicationTime
    ){
        Reservation reservation = new Reservation(null, name, phone, gender, LocalDateTime.parse(communicationTime), province, estimatedScore);
        reservationService.insert(reservation);
    }
    @Tool("查询志愿填报服务")
    public Reservation findReservationByPhone(
            @P("考生手机号码") String phone
    ){
        return reservationService.findByPhone(phone);
    }
}
